#ifndef DATABASE_TABLE_H
#define DATABASE_TABLE_H
/*

*/

#include "fieldset.h"

#include <map>
#include <mutex>
#include <string>

namespace Database
{

using std::map;
using std::mutex;
using std::string;
using std::vector;

class Table
{
public:
    Table() = delete;
    Table(const string& name);
    Table(const Table& rhs) = delete;
    ~Table();

    const Table& operator=(const Table&) = delete;

	const ColumnSpec& column(const char *name) const;
	const ColumnSpec& column(const unsigned int offset) const;

    Table& open();
    void close();

    void lockRead();
    void lockWrite();
    void unlockRead();
    void unlockWrite();

private:
	map<string, ColumnSpec> fields_;
	int refs_;
	mutex readLock_;
	mutex writeLock_;
};

}	// namespace Database

#endif
